package com.ossjk.oa.attendance.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.mapper.SqlHelper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ossjk.oa.attendance.entity.Atdtable;
import com.ossjk.oa.attendance.mapper.AtdtableMapper;
import com.ossjk.oa.attendance.service.IAtdtableService;
import com.ossjk.oa.attendance.vo.AtdtableVo;

/**
 * 服务实现类
 * 
 * @Author Datou
 * @Version 1.0, 2020-05-23
 * @See
 * @Since com.ossjk.oa.attendance.service.impl
 * @Description: TODO
 */
@Service
public class AtdtableServiceImpl extends ServiceImpl<AtdtableMapper, Atdtable> implements IAtdtableService {

	@Autowired
	private IAtdtableService iAtdtableService;

	@Override
	public boolean geneAtdTable(Atdtable atdtable) {
		// 删除已有报表
		Wrapper wrapper = Condition.create().eq("eid", atdtable.getEid()).eq("did", atdtable.getDid());
		iAtdtableService.delete(wrapper);
		return iAtdtableService.insert(atdtable);
	}

	@Override
	public Page selectVoPage(Page page, Wrapper wrapper) {
		SqlHelper.fillWrapper(page, wrapper);
		page.setRecords(baseMapper.selectVoPage(page, wrapper));
		return page;
	}

	@Override
	public AtdtableVo selectVo(Wrapper wrapper) {
		// TODO Auto-generated method stub
		return baseMapper.selectVo(wrapper);
	}

}
